package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.HospInfo;
import com.dhcc.DRGsHosp.facade.dto.HospInfoDTO;

public class HospInfoAssembler {
	
	public static HospInfoDTO  toDTO(HospInfo  hospInfo){
		if (hospInfo == null) {
			return null;
		}
		HospInfoDTO result  = new HospInfoDTO();
		result.setHospOrder(hospInfo.getHospOrder());
		result.setHospCode(hospInfo.getHospCode());
		result.setHospName(hospInfo.getHospName());
		result.setHospLevel(hospInfo.getHospLevel());
		result.setHospShortName(hospInfo.getHospShortName());
 	    return result;
	 }
	
	public static List<HospInfoDTO>  toDTOs(Collection<HospInfo>  hospInfos){
		if (hospInfos == null) {
			return null;
		}
		List<HospInfoDTO> results = new ArrayList<HospInfoDTO>();
		for (HospInfo each : hospInfos) {
			results.add(toDTO(each));
		}
		return results;
	}
	
	 public static HospInfo  toEntity(HospInfoDTO  hospInfoDTO){
	 	if (hospInfoDTO == null) {
			return null;
		}
	 	HospInfo result  = new HospInfo();
		result.setHospOrder(hospInfoDTO.getHospOrder());
	 	result.setHospCode(hospInfoDTO.getHospCode());
	 	result.setHospName(hospInfoDTO.getHospName());
	 	result.setHospLevel(hospInfoDTO.getHospLevel());
	 	result.setHospShortName(hospInfoDTO.getHospShortName());
 	  	return result;
	 }
	
	public static List<HospInfo> toEntities(Collection<HospInfoDTO> hospInfoDTOs) {
		if (hospInfoDTOs == null) {
			return null;
		}
		
		List<HospInfo> results = new ArrayList<HospInfo>();
		for (HospInfoDTO each : hospInfoDTOs) {
			results.add(toEntity(each));
		}
		return results;
	}
}
